<?php
/**
 * 短信管理
 * @author a
 *
 */
class Message extends CT_Controller{
    
    private $offse = 0;
    private $page_size = 0;
    private $page = 0;
    private $size = 10; //每页显示数量
    private $substr_num = 10;   //列表显示留言数量
    
    function __construct()
    {
        parent::__construct();
        $this->load->helper("arraytool");   //加载工具
        $this->load->helper("tools_helper");   //加载工具
        $this->t = $this->ct_template;
        
        $this->load->model('send_sms_log_model');
        
        //分页
        $this->page = $this->input->get('per_page',TRUE) ? intval($this->input->get('per_page',TRUE)) : 1;
        $this->page_size = $this->config->item('per_page')?$this->config->item('per_page'):$this->size;
        $this->offse = ($this->page-1) * $this->page_size;
        
    }
    
    /**
     * 列表
     */
    public function Index(){
        try {
            //$fild = 'id as order_id,course_package_id,hours,surplus_hours,status';
            //$where = "nursery_id = '$this->_nursery_id'";
            $messae_list = $this->send_sms_log_model->findAll(array(),'*','id desc',$this->offse,$this->page_size);
            if(empty($messae_list))throw new Exception('没有记录');
            
            $total = $this->send_sms_log_model->findCount(array()); //总数
            $pagelink = $this->pagination($total,$this->page_size);
                        
            //echo '<pre>';print_r($book_list);die();
            $this->t->write_view('content', 'admin/message/index', array(
                'pagelink'     =>  $pagelink,
                'messae_list'    =>  $messae_list,
            	'sms_type'	=>	array(0=>'未知',1=>'登录'),
            ), false);
            
            $this->t->render();
            
        }catch (Exception $e){
            $error = $e->getMessage();
            $this->t->write_view('content', 'nursery/msg_error', array(
                'error'     =>  $error,
                'time'  =>  10,
                'url'   =>  '/admin/book/',
            ), false);
            $this->t->render();
        }
        
    }
}






























